# generate a synthetic dataset with known classes: 50 features, 18 samples (5+5+8)
n <- 50; counts <- c(5, 5, 8);
V <- syntheticNMF(n, counts, noise=TRUE)
metaHeatmap(V)
# build the class factor
groups <- as.factor(do.call('c', lapply(seq(3), function(x) rep(x, counts[x]))))
# perform multiple runs of NMF (keep best only)
res <- nmf(V, 3, nrun=5)
res
# compute summary measures
summary(res)
# compute more summary measures
summary(res, target=V, class=groups)
# plot a heatmap of the consensus matrix with extra annotations
metaHeatmap(res, class=groups)
# retrieve the predicted clusters of samples
predict(res)
# perform multiple runs of NMF and keep all the runs
res <- nmf(V, 3, nrun=5, .options='k')
res
# extract best fit
fit(res)
# compute/show computational times
runtime.all(res)
seqtime(res)
Run the code above in your browser using DataLab